Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add onunmount hook (#1212) #1234

Closed
wants to merge 3 commits into from
Closed

Conversation

aphitiel
Copy link
Contributor

@aphitiel aphitiel commented Mar 13, 2018

Not sure this is PR-material, as I have to admit that I have no clear idea of what I'm doing.

Edit: Attempt at Issue #1212. Will improve coverage when this is the right direction.

In my case the problem (on the surface) was that in ondestroy a referenced DOM-node didn't have a parentNode. So that's what I tested against.

Interestingly, in ondestroy on a root component, the parentNode is still there. That's why the lifecycle-events-test got a nested component.

(Maybe ondestroy could simply fire before detachment?)

It seemed easiest to just add an onunmount-hook. This magically disappears in the compiled output if unused, and doesn't hurt any tests.

@codecov-io
Copy link

codecov-io commented Mar 13, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@bec49a0). Click here to learn what that means.
The diff coverage is 55.55%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1234   +/-   ##
=========================================
  Coverage          ?   91.65%           
=========================================
  Files             ?      127           
  Lines             ?     4579           
  Branches          ?     1500           
=========================================
  Hits              ?     4197           
  Misses            ?      159           
  Partials          ?      223
Impacted Files Coverage Δ
src/validate/js/propValidators/index.ts 100% <ø> (ø)
src/validate/js/propValidators/onunmount.ts 0% <0%> (ø)
src/generators/Generator.ts 94.05% <100%> (ø)
src/generators/dom/index.ts 96.21% <100%> (ø)
src/generators/dom/Block.ts 96.09% <50%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bec49a0...7661c28. Read the comment docs.

@aphitiel
Copy link
Contributor Author

I finally got around to trying to solve the problem this PR was for (including CodeMirror - EasyMDE to be precise) with actions, which works much better.

Can we close this PR and assume that #1212 is generally fixed with actions?

@Rich-Harris
Copy link
Member

Can we close this PR and assume that #1212 is generally fixed with actions?

Sounds good, will close #1212. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants